<?php

namespace App\Http\Controllers\Api;

use App\Models\Category;
use Illuminate\Http\Request;
use App\Http\Transformers\CategoryTransformer;

class CategoryController extends BaseController {

    //获取分类树
    public function index($categoryId = 0) {
        $categories = Category::where('parent_id', $categoryId)->get();
        return $this->response->collection($categories, new CategoryTransformer());
    }

}
